import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-ningxia-panel',
  templateUrl: './ningxia-panel.component.html',
  styleUrls: ['./ningxia-panel.component.scss']
})
export class NingxiaPanelComponent implements OnInit {
  pieOpt1: any = {
    title: {
      text: '{value|取水口总量}\n{value|912.2亿方}',
      zlevel: 0,
      rich: {
        name: {
          color: '#909399',
          fontSize: 12,
          fontWeight: 'normal',
          lineHeight: 18,
        },
        value: {
          color: '#3d3d3d',
          fontSize: 12,
          fontWeight: 'bold',
          lineHeight: 22,
        },
      },
      top: 'center',
      left: '105',
      textAlign: 'center',
      textStyle: {
        rich: {
          name: {
            color: '#909399',
            fontSize: 12,
            fontWeight: 'normal',
            lineHeight: 18,
          },
          value: {
            color: '#3d3d3d',
            fontSize: 12,
            fontWeight: 'bold',
            lineHeight: 22,
          },
        },
      },
    },
    tooltip: {
      trigger: 'item',
      formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    color: ['#637efe', '#ffc209', '#0094f0', '#d2e2ff'],
    legend: {
      orient: 'vertical',
      x: 'right',
      itemGap: 25,
      top: 'middle',
      align: 'left',
      icon: 'circle',
      // formatter: name =>  {
      //     return name;
      // }
    },
    series: [
      {
        name: '取水指标',
        type: 'pie',
        radius: ['40%', '69%'],
        center: [110, '50%'],
        stillShowZeroSum: false,
        avoidLabelOverlap: false,
        zlevel: 1,
        label: {
          show: false
        },
        data: [
          {value: 48, name: "地表水取水站 48%"},
          {value: 44, name: "地下水取水站 44%"},
          {value: 12, name: "退水站 12%"},
          {value: 6, name: "排水站 6%"}
        ]
      }
    ]
  };
  pieOptChange1: any = {};
  /*pieOpt2 = {
    title: {
      text: '{value|取水指标}',
      zlevel: 0,
      rich: {
        name: {
          color: '#909399',
          fontSize: 12,
          fontWeight: 'normal',
          lineHeight: 18,
        },
        value: {
          color: '#3d3d3d',
          fontSize: 12,
          fontWeight: 'bold',
          lineHeight: 22,
        },
      },
      top: 'center',
      left: '105',
      textAlign: 'center',
      textStyle: {
        rich: {
          name: {
            color: '#909399',
            fontSize: 12,
            fontWeight: 'normal',
            lineHeight: 18,
          },
          value: {
            color: '#3d3d3d',
            fontSize: 16,
            fontWeight: 'bold',
            lineHeight: 22,
          },
        },
      },
    },
    tooltip: {
      trigger: 'item',
      formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    color: ['#637efe', '#ffc209', '#0094f0', '#d2e2ff'],
    legend: {
      orient: 'vertical',
      x: 'right',
      itemGap: 25,
      top: 'middle',
      align: 'left',
      icon: 'circle',
      // formatter: name =>  {
      //     return name;
      // }
    },
    series: [
      {
        name: '取水指标',
        type: 'pie',
        radius: ['40%', '69%'],
        center: [110, '50%'],
        stillShowZeroSum: false,
        avoidLabelOverlap: false,
        zlevel: 1,
        label: {
          show: false
        },
        data: [
          {value: 6.557, name: '工业生活 10.03%'},
          {value: 2.408, name: '生态用水 3.69%'},
          {value: 54.497, name: '直开口 83.38%'},
          {value: 1.896, name: '沿黄小高抽 2.9%'}
        ]
      }
    ]
  };*/
  pieOpt2 = {
    tooltip: {
      trigger: 'axis',
      axisPointer: {            // 坐标轴指示器，坐标轴触发有效
        type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
      },
      formatter: params => {
        const tar = params[0];
        return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
      }
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'category',
      splitLine: {show: false},
      data: ['工业生活', '生态用水', '直开口', '沿黄小高抽']
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      name: '补水量',
      type: 'bar',
      label: {
        fontSize: 10,
        show: true,
        position: 'top'
      },
      itemStyle: {
        normal: {
          // 随机显示
          // color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}

          // 定制显示（按顺序）
          color: params => {
            const colorList = ['#C33531', '#EFE42A', '#64BD3D', '#EE9201', '#29AAE3', '#B74AE5', '#0AAF9F', '#E89589', '#16A085', '#4A235A', '#C39BD3 ', '#F9E79F', '#BA4A00', '#ECF0F1', '#616A6B', '#EAF2F8', '#4A235A', '#3498DB'];
            return colorList[params.dataIndex];
          }
        },
      },
      data: [  {value: 6.557, name: '工业生活'},
        {value: 2.408, name: '生态用水'},
        {value: 54.497, name: '直开口'},
        {value: 1.896, name: '沿黄小高抽'}]
    }]
  };
  pieOptChange2: any = {};
  /*pieOpt3: any =  {
    tooltip: {
      trigger: 'item',
      formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    color: ['#637efe', '#ffc209', '#0094f0', '#d2e2ff', '#FB7293', '#E7BCF3'],
    series: [
      {
        name: '面积模式',
        type: 'pie',
        radius: [15, 45],
        center: ['50%', '40%'],
        roseType: 'area',
        label: {
          formatter: '{b|{b}：}\n({c}亿m³) {per|{d}%}',
          rich: {
            b: {
              color: '#555555',
              fontSize: 12,
              lineHeight: 18,
              align: 'center'
            },
            c: {
              color: '#999999'
            },
            per: {
              color: '#ffffff',
              backgroundColor: '#009FFF',
              padding: [2, 4],
              borderRadius: 4
            }
          }
        },
        data: [
          {value: 59.95, name: '干渠取水'},
          {value: 2.99, name: '工业生活'},
          {value: 1.896, name: ' 沿黄小高抽'},
          {value: 0.3, name: '中南部饮水'},
          {value: 1.21, name: ' 截潜取水'},
          {value: 6.37, name: '地下水'}
        ]
      }
    ]
  };*/
  pieOpt3 = {
    title: {
      text: '{value|取水指标}',
      zlevel: 0,
      rich: {
        name: {
          color: '#909399',
          fontSize: 12,
          fontWeight: 'normal',
          lineHeight: 18,
        },
        value: {
          color: '#3d3d3d',
          fontSize: 12,
          fontWeight: 'bold',
          lineHeight: 22,
        },
      },
      top: 'center',
      left: '105',
      textAlign: 'center',
      textStyle: {
        rich: {
          name: {
            color: '#909399',
            fontSize: 12,
            fontWeight: 'normal',
            lineHeight: 18,
          },
          value: {
            color: '#3d3d3d',
            fontSize: 16,
            fontWeight: 'bold',
            lineHeight: 22,
          },
        },
      },
    },
    tooltip: {
      trigger: 'item',
      formatter: '{a} <br/>{b}: {c} ({d}%)'
    },
    color: ['#637efe', '#ffc209', '#0094f0', '#d2e2ff', '#FB7293', '#E7BCF3'],
    legend: {
      orient: 'vertical',
      x: 'right',
      itemGap: 10,
      top: 'middle',
      align: 'left',
      icon: 'circle',
      // formatter: name =>  {
      //     return name;
      // }
    },
    series: [
      {
        name: '取水指标',
        type: 'pie',
        radius: ['40%', '69%'],
        center: [110, '50%'],
        stillShowZeroSum: false,
        avoidLabelOverlap: false,
        zlevel: 1,
        label: {
          show: false
        },
        data: [
          {value: 59.95, name: '干渠取水 82.45%'},
          {value: 2.99, name: '工业生活 4.11%'},
          {value: 1.896, name: ' 沿黄小高抽 2.61%'},
          {value: 0.3, name: '中南部饮水 0.41%'},
          {value: 1.21, name: ' 截潜取水 1.66%'},
          {value: 6.37, name: '地下水 8.76%'}
        ]
      }
    ]
  };
  pieOptChange3: any = {};

  constructor() { }

  ngOnInit(): void {
  }

}
